<?php
header("Content-Type:text/html;charset=utf-8");
include_once "util.php";
$diseaseListURL = "http://jbk.39.net/bw_t1_p";
$diseaseListStartPage = 0;
$diseaseListEndPage = 779;
$diseasePages = [];
for ($currentDiseaseListPage = $diseaseListStartPage; $currentDiseaseListPage <= $diseaseListEndPage; $currentDiseaseListPage++) {
    $listContent = getHTML($diseaseListURL . $currentDiseaseListPage);
    preg_match_all('/<a href="http:\/\/jbk.39.net\/\w+\/" title=".*">.*<\/a>/U', $listContent, $links);
    foreach ($links[0] as $link) {
        preg_match("/(http:\/\/jbk.39.net\/\w+\/).*title=\"(.*)\"/U", $link, $match);
        $diseasePages[$match[2]] = $match[1];
    }
    echo "Disease Page Link Done: {$currentDiseaseListPage} / {$diseaseListEndPage}\n";
}
dumpVariableToFile($diseasePages, "diseasePages.php", "diseasePages");
$symptonListURL = "http://jbk.39.net/bw_t2_p";
$symptonListStartPage = 0;
$symptonListEndPage = 675;
$symptonPages = [];
for ($currentPage = $symptonListStartPage; $currentPage <= $symptonListEndPage; $currentPage++) {
    $listContent = getHTML($symptonListURL . $currentPage);
    preg_match_all('/<a href="http:\/\/jbk.39.net\/zhengzhuang\/\w+\/" title=".*">.*<\/a>/U', $listContent, $links);
    foreach ($links[0] as $link) {
        preg_match("/(http:\/\/jbk.39.net\/zhengzhuang\/\w+\/).*title=\"(.*)\"/U", $link, $match);
        $symptonPages[$match[2]] = $match[1];
    }
    echo "Sympton Page Link Done: {$currentPage} / {$symptonListEndPage}\n";
}
dumpVariableToFile($symptonPages, "symptonPages.php", "symptonPages");